﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AssignmentSWEN3.App_Code;

namespace AssignmentSWEN3
{
    public partial class HouseKeepingView : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnID_Click(object sender, EventArgs e)
        {
            lblResult.Text = "";
            string id = tbxID.Text;
            Staff s = DataManager.GetStaffByID(Convert.ToInt32(id));
            lblResult.Text += "StaffOID: " + s.StaffOID + "<br/>" + "Name: " + s.Name + "<br/>" + " DOB: " + s.Dob + "<br/>" + "BankAccount: " + s.BankAccNum + "<br/>" + "Address: " + s.Address + "<br/>" + "Phone No: " + s.PhoneNum + "<br/>" + "DutyType: " + s.DutyType + "<br/>" + "Email: " + s.Email + "<br/>" + "Password: " + s.Password + "<br/>";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("BookingView.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string staff = tbxID.Text;
            Server.Transfer("HouseKeepingUpdate.aspx?staffID=" + staff);
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("HousekeepingCreate.aspx");
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            Staff dstaff = new Staff();
            int id = Convert.ToInt32(tbxID.Text);
            
            if (DataManager.DeleteStaff(id) == 1)
            {
                lblResult.Text = "Staff Deleted";
            }
            else
            {
                lblResult.Text = "Could not delete";
            }
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Response.Redirect("Reporting.aspx");
        }
    }
}